package com.lx.backstagemanagement.security.model;

import org.apache.commons.lang.StringUtils;

/**
 * @author Levin
 * <p>
 * 2017-05-25
 */
public class UserContext {
    private final String username;
//    private final List<GrantedAuthority> authorities;

//    private UserContext(String username, List<GrantedAuthority> authorities) {
//        this.username = username;
//        this.authorities = authorities;
//    }

    private UserContext(String username) {
        this.username = username;
    }

//    public static UserContext create(String username, List<GrantedAuthority> authorities) {
//        if (StringUtils.isBlank(username)) throw new IllegalArgumentException("Username is blank: " + username);
//        return new UserContext(username, authorities);
//    }

    public static UserContext create(String username) {
        if (StringUtils.isBlank(username)) throw new IllegalArgumentException("Username is blank: " + username);
        return new UserContext(username);
    }

    public String getUsername() {
        return username;
    }

//    public List<GrantedAuthority> getAuthorities() {
//        return authorities;
//    }
}
